package com.vm.utils;

import android.content.Context;
import android.content.pm.PackageManager;

/**
 * 
 * @ProjectName: [WeiMai]
 * @Author: [kent.wang]
 * @CreateDate: [2015年2月8日 下午12:30:04]
 * @Version: [v1.0]
 * 
 */
public class ApkUtils {

	public static boolean isAppInstalled(String packageName, Context context) {
		PackageManager pm = context.getPackageManager();
		boolean installed = false;
		try {
			pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
			installed = true;
		} catch (PackageManager.NameNotFoundException e) {
			installed = false;
		}
		return installed;
	}

	// 根据路径名获取包名
	// PackageManager pm = getPackageManager();
	// PackageInfo info = pm.getPackageArchiveInfo(apkInfo.getPath(),
	// PackageManager.GET_ACTIVITIES);
	// ApplicationInfo appInfo = null;
	// if (info != null) {
	// progressText.setText("已安装");
	// appInfo = info.applicationInfo;
	// String packageName = appInfo.packageName;
	// // mTvTest.setText(packageName);
	// }


}
